<template>
    <el-dialog :title="title" :visible.sync="show" append-to-body :before-close="close">
      <el-table stripe :data="list" max-height="300"  :default-sort = "{prop: 'visitPlanDate', order: 'descending'}">
        <el-table-column type="index" label="序号" width="50"></el-table-column>
        <el-table-column label="客户编码" prop="customerCode"></el-table-column>
        <el-table-column label="客户名称" width="150" show-overflow-tooltip prop="customerName"></el-table-column>
        <el-table-column sortable label="计划回访时间" width="150" prop="visitPlanDate"></el-table-column>
        <el-table-column sortable label="最近回访时间"  width="150" prop="lastVisitCompletionDate"></el-table-column>
      </el-table>
    </el-dialog>
</template>
<script>
import Mixins from '../mixins'
export default {
  props: {
    visible: Boolean,
    params: Object
  },
  mixins: [Mixins],
  watch: {
    visible: {
      handler (val) {
        this.show = val
        if (val) {
          this.queryForgottenCustomerList()
        }
      },
      immediate: true
    },
    params: {
      handler (val) {
        this.title = val.desc || ''
      },
      deep: true,
      immediate: true
    }
  },
  components: {},
  data () {
    return {
      show: false,
      title: '',
      list: []
    }
  },
  methods: {
    close () {
      this.show = false
      this.$emit('update:visible', false)
    },
    queryForgottenCustomerList () {
      const params = {}
      params.typeCode = this.params.typeCode
      if (params.typeCode) {
        this.requestOption('queryForgottenCustomerList', params, res => {
          this.list = res.data || []
        })
      }
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
